<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">
<title>View Student Details</title>
</head>
<style type="text/css">
th {text-align: right}
</style>
<body>

<?php include 'top.html'; ?>
<?php include '../../authorization_check.php'; ?>
<?php include '../../checkStudentOnly.php'; ?>
<?php

	session_start();
	$studentID = $_SESSION['uname'];
	//echo $studentID;
?>

<p>
<?php

	require_once '../../commonutils/db/DBConnectionManager.php';

	$sqlquery = "select * from student where studentID = ".$studentID;
	$result = DBConnectionManager::query($sqlquery);
	$num_rows = mysql_num_rows($result) or die(mysql_error());
	if($num_rows == 0){
		//header('Location: ../../Login.php');
	}
	else{
		$row = mysql_fetch_assoc($result);
		echo "<center><table border=\"1\" width=\"62%\" id=\"table1\">";
		echo "<tr><td colspan=\"3\" height=\"20\"><center><h1>Student Details</h1></center></td></tr>";
		echo "<tr>";
		echo "<td width=\"222\">Student ID</td>";
		echo "<td width=\"251\">".$row['studentID']."</td>";
		echo "<td width=\"150\" rowspan=\"5\">";
		echo "<img src=\"ViewPicture.php\" height=\"179\" width=\"144\"></img></td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td width=\"222\">Name</td>";
		echo "<td width=\"251\">".$row['firstName']."</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td width=\"222\">Surname</td>";
		echo "<td width=\"251\">".$row['lastName']."</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td width=\"222\">Citizenship Number</td>";
		echo "<td width=\"251\">".$row['TC_Kimlik']."</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td width=\"222\">Date of Birth (DD/MM/YYYY)</td>";
		$birthDate3 = substr($row['birthDate'], 0, 4);
 		$birthDate2 = substr($row['birthDate'], 5, 2);
 		$birthDate1 = substr($row['birthDate'], 8, 2);
		echo "<td width=\"251\">".$birthDate1."/".$birthDate2."/".$birthDate3."</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td width=\"222\">Place of Birth</td>";
		echo "<td width=\"402\" colspan=\"2\">".$row['birthPlace']."</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td width=\"222\">Address</td>";
		echo "<td width=\"402\" colspan=\"2\"><textarea readonly=readonly rows=\"3\" name=\"txtAddress\" cols=\"40\">".$row['address']."</textarea></td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td width=\"222\">Home telephone</td>";
		echo "<td width=\"402\" colspan=\"2\">".$row['homeTel']."</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td width=\"222\">Office telephone</td>";
		echo "<td width=\"402\" colspan=\"2\">".$row['officeTel']."</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td width=\"222\">Mobile telephone</td>";
		echo "<td width=\"402\" colspan=\"2\">".$row['mobileTel']."</td>";
		echo "</tr>";
		//echo "<tr>"
		//echo "<td width=\"222\">Program</td>"
		//echo "<td width=\"402\" colspan=\"2\">".$row[</td>"
		//echo "</tr>"
		echo "<tr>";
		echo "<td width=\"222\">Academic Details</td>";
		echo "<td width=\"402\" colspan=\"2\"><textarea rows=\"4\" name=\"txtAcademic\" cols=\"40\">".$row['academic']."</textarea></td>";
		echo "</tr>";
		echo "</table></center>";
		

	}	
?>
</p>  

<br>
<hr color="blue">
<p>
<a href="../../StudentIndex.php"> Back </a>
</p>

</body>

</html>
